package com.webfinal.backsystem.controller;

import com.webfinal.backsystem.request.carousel.AddCarouselRequest;
import com.webfinal.backsystem.request.carousel.UpdateCarouselRequest;
import com.webfinal.backsystem.response.carousel.AddCarouselResponse;
import com.webfinal.backsystem.response.carousel.GetCarouselResponse;
import com.webfinal.backsystem.response.carousel.UpdateCarouselReponse;
import com.webfinal.backsystem.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class CarouselController {
    @Autowired
    private CarouselService carouselService;

    @RequestMapping(value = "/api/carousel/get")
    public GetCarouselResponse getCarousel(){
        return carouselService.getCarousel();
    }

    @RequestMapping(value = "/api/carousel/addcarousel")
    public AddCarouselResponse addcarousel(@RequestBody  AddCarouselRequest addCarouselRequest){
        return carouselService.addCarousel(addCarouselRequest);
    }

    @RequestMapping(value = "/api/carousel/updatecarousel")
    public UpdateCarouselReponse addcarousel(@RequestBody UpdateCarouselRequest updateCarouselRequest){
        return carouselService.updateCarousel(updateCarouselRequest);
    }

}
